home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
util1
/
tempconv.lha
/
tempconv.b
< prev
next >
Wrap
Text File
|
1995-11-18
|
826b
|
55 lines
/*Fahrenheit<->Celsius converter*/
DIM y$(5)
for x=1 to ARGCOUNT
y$(x)=UCASE$(ARG$(x))
next x
z$=RIGHT$(y$(1),1)
if z$<> "C" AND z$<>"F" goto usage
w=LEN(y$(1))-1
if w=0 goto usage
v$=LEFT$(y$(1),w)
for i=1 to (w)
if ASC(MID$(v$,i,1))<48 or ASC(MID$(v$,i,1))>57 then
print "Invalid argument."
goto usage
end if
next i
u=VAL(v$)
if z$="C" goto c2f
t=(u-32)/9*5
a$=STR$(t)+"C"
goto qt
c2f:
t=u*1.8+32
a$=STR$(t)+"F"
qt:
ans$=y$(1)+" = "+a$
print ans$
end
usage:
print "tempconv <temp>"
print " "
print "temp should be a numeric argument"
print "followed by an F for fahrenheit"
print "temps to be converted to celsius"
print "or by a C for celsius temps to be"
print "converted to fahrenheit."
print " "
print "©1995 William F. Maddock"
stop